/**
 * @version Create on 2012-11-2
 * @author Yinzi Chen
 */

public class MaximumDepthOfBinaryTree {

	class TreeNode {
		int val;
		TreeNode left;
		TreeNode right;

		TreeNode(int x) {
			val = x;
		}
	}

	int max, dep;

	public int getMax(TreeNode root) {
		if (root == null)
			return dep;
		dep++;
		max = Math.max(max, getMax(root.left));
		max = Math.max(max, getMax(root.right));
		dep--;
		return max;
	}

	public int maxDepth(TreeNode root) {
		max = 0;
		dep = 0;
		return getMax(root);
	}

	public static void main(String[] args) {

	}

}
